package com.nars.networking;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.SocketException;
import java.net.UnknownHostException;

public class DatagramClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws UnknownHostException {
		int port;
		InetAddress address;
		DatagramSocket socket = null;		
		byte[] sendBuf = new byte[256];
		//MulticastSocket sender = new MulticastSocket();

		try {
			socket = new DatagramSocket();
			DatagramPacket packet = new DatagramPacket(sendBuf, sendBuf.length);
			try {
				socket.receive(packet);
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			String received = new String(packet.getData(), 0, packet.getLength());
			System.out.println("Quote of the Moment: " + received);
			try {
				socket.receive(packet);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
